// 智能锁列表
import debounce from "debounce";
import * as MSroomAPI from "../../api/interfaces/MSroom";
import { HttpHandler } from "../../api/handle/httpHandler";
import { AES_Encrypt } from "../../utils/crypto";

Page({
  data: {
    hotelList: [

    ],

  },
  onLoad() {
    console.log("load page");

  },

  onShow() {
    // wx.showLoading({ title: "" });
    this.getHotelList();
  },

  // 进入酒店详情
  toDetail(e) {
    wx.navigateTo({
      url: "/pages/manageRoom/manageRoom",
      success: function (res) {
        // 通过eventChannel向被打开页面传送数据
        res.eventChannel.emit('hotelInfo', {
          item: e.currentTarget.dataset.query,
        })
      }
    })
  },


  /* TODO 处理用户错误日志, 用户可自行操作日志上传 */
  handleShowLog(...args: any) {
    console.log("操作日志:", ...args);
  },
  // 获取酒店列表
  getHotelList() {
    MSroomAPI.msHotelBase().then(res => {
      if (res.result) {
        let demo = res.result.records
        demo.forEach(e => {
          e.cover = 'https://lyms.imsdx.net/lyms/' + e.cover.split(',')[0]
        });
        this.setData({ hotelList: demo });
      }
    })
  },

  toHome() {


    wx.switchTab({
      url: "/pages/hotelList/hotelList",
      success: function (res) {
        wx.removeStorageSync('token')
        wx.removeStorageSync('role')
      }
    })
  },
  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {
    // this.modifyKeyList();
  },

  onReachBottom() {
    // this.modifyKeyList(this.data.currentPageNo + 1);
  },







})